<?php
namespace app\api\controller;

class Cate extends Base
{
    public function lists(){
        $top_cate_lists=model("cate")->where("up_id",0)->order("sort")->select();
        $list=[];
        foreach ($top_cate_lists as $item){

            $id=$item['id'];
            $sublist=[];
            $sublist_query=model("cate")->where("up_id",$id)->order("sort")->select();
            foreach ($sublist_query as $subitem){
                $sublist[]=$subitem;
            }
            $item['sublist']=$sublist;
            $list[]=$item;
        }
        return s($list);
    }
}
